package org.example.tree;

/**
 * Author: wu-meng
 * Time: 2024.12.12
 * 反转二叉树
 */
public class Solution38 {
    public TreeNode invertTree(TreeNode root) {
        if (root == null) {
            return null;
        }

        TreeNode temp = root.left;
        root.left = invertTree(root.right);
        root.right = invertTree(temp);
        return root;
    }
}
